package fr.umlv.m2.uwp2011.web.client.secretary;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.VerticalPanel;

import fr.umlv.m2.uwp2011.web.client.Application;
import fr.umlv.m2.uwp2011.web.client.Session;

public class SecretaryMenu extends Composite {

	/**
	 * Home page link.
	 */
	private final Hyperlink home;
	/**
	 * Disconnect link.
	 */
	private final Hyperlink disconnect;

	/**
	 * Cursus editor page link.
	 */
	private final Hyperlink cursusEditor;

	/**
	 * Menu Panel.
	 */
	private final VerticalPanel menuPanel;
	/**
	 * Main panel.
	 */
	private final VerticalPanel menu;


	public SecretaryMenu(Session session) {
		/****************************** Widgets Creation ******************************/
		this.home = new Hyperlink("Accueil", Application.SECRETARY_HOMEPAGE
				+ "?login=" + session.getParameters().get("login") + "&key="
				+ session.getParameters().get("key"));
		this.disconnect = new Hyperlink("D&eacute;connexion", true,
				Application.LOGIN_PAGE);

		this.cursusEditor = new Hyperlink("Edition du cursus",
				Application.SECRETARY_CURSUS_EDITOR);

		this.menuPanel = new VerticalPanel();
		this.menu = new VerticalPanel();

		/******************************** Widgets style *******************************/
		this.home.addStyleName("menuLink");
		this.disconnect.addStyleName("menuLink");
		this.cursusEditor.addStyleName("menuLink");

		/******************************** Page building *******************************/
		this.menuPanel.add(home);
		this.menuPanel.add(cursusEditor);
		this.menuPanel.add(disconnect);

		this.menu.add(this.menuPanel);

		initWidget(this.menu);
	}
}
